package com.irdstudio.efp.flow.common.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.irdstudio.basic.framework.core.util.HsfGenericUtils;
import com.irdstudio.basic.framework.core.util.SerializeUtils;
import com.irdstudio.basic.framework.core.vo.PluginVO;

/**
 * 
 * pluginvo 处理工具类
 * 
 * @author Cytus_
 * @since 2018年5月11日 上午9:08:31
 * @version 1.0
 *
 */
public final class EngineUtil {
	
	//private static Logger logger = LoggerFactory.getLogger(EngineUtil.class);
	
	public static String CLASS_MAPPING = "@";
	
	public static String KEY_MAPPING = "::";
	
	public static String VO_SPLIT = ";;";
	
	/**
	 * 序列化
	 * @param vo
	 * @return
	 * @throws Exception
	 */
	public static String serializePluginVo(PluginVO vo) throws Exception {
		return SerializeUtils.serializeStr(vo);
	}
	
	/**
	 * pluginVo 反序列化
	 * @param str
	 * @return
	 * @throws Exception
	 */
	public static PluginVO deserializePluginVo(String str) throws Exception {
		return SerializeUtils.deserialize(str, PluginVO.class);
	}
	
	/**
	 * 页面请求数据转换
	 * @param pageData
	 * @return
	 * @throws Exception
	 */
	public static List<Object> pageDataExchange(List<Map<String, Object>> pageData) throws Exception {
		List<Object> rtnList = new ArrayList<Object>();
		for (Map<String, Object> data : pageData) {
			rtnList.add(HsfGenericUtils.exchangeRtnData(data));
		}
		return rtnList;
	}
	
	
}
